//
//  TZjingPinSection2Cell.m
//  XMLYFM
//
//  Created by dllo on 15/12/25.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import "TZjingPinSection2Cell.h"
#import <UIImageView+WebCache.h>
#import "AppTools.h"

@implementation TZjingPinSection2Cell





-(void)setJingPinDetail:(TZjingPinDetailModel *)JingPinDetail
{

    self.TitleLabel.text = JingPinDetail.title;
    
    NSString *Str = JingPinDetail.coverSmall;
    NSURL *url = [NSURL URLWithString:Str];
    [self.headImage sd_setImageWithURL:url placeholderImage:PLACEHOLDER_IMAGE];
    self.subTitle.text = JingPinDetail.nickname;
    
    CGFloat hear = JingPinDetail.playsCounts / 10000.0;
    
    NSInteger temp = JingPinDetail.playsCounts / 1000;
    NSInteger yu = temp % 10;
    
    //听
    if (JingPinDetail.playsCounts > 10000 ) {
       
//        NSLog(@"🐴🐴🐴🐴🐴🐴🐴🐴🐴🐴🐴🐴%ld",yu);
        if (yu == 0) {
            self.hearedLabel.text = [NSString stringWithFormat:@"%ld",JingPinDetail.playsCounts / 10000];
        }
        else
        {
            
            self.hearedLabel.text = [NSString stringWithFormat:@"%.1f",hear];
        }

    }
    else
    {
        self.hearedLabel.text = [NSString stringWithFormat:@"%ld",JingPinDetail.playsCounts];
    
    
    }
    
    
    //播放时长
    NSInteger time = JingPinDetail.duration;
    NSInteger flTime = time / 60;
    NSInteger timeYu = time % 60;

    
    if (timeYu >= 10) {
        self.timeLabel.text = [NSString stringWithFormat:@"%ld:%ld",flTime,timeYu];
        
    }
    else
    {
     self.timeLabel.text = [NSString stringWithFormat:@"%ld:0%ld",flTime,timeYu];
    
    
    }
   
    
    //喜欢个数
    self.likeLabel.text = [NSString stringWithFormat:@"%@",JingPinDetail.favoritesCounts];
    
    //评论
    
    self.countLabel.text = [NSString stringWithFormat:@"%@",JingPinDetail.commentsCounts];
    
//    NSLog(@"%@",[AppTools timestampExchange:JingPinDetail.createdAt]);
self.DistanceTime.text = [AppTools prettyDateWithReference:[NSDate dateWithTimeIntervalSince1970:JingPinDetail.createdAt/1000]];

   

    
}







- (void)awakeFromNib {
    // Initialization code
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
